
Ext.define('DCApp.view.attach.List', {
    extend: 'DCApp.view.List',
    alias: 'widget.CeAttachmentlist',

    controller: 'attachlist',
    viewModel: {
        type: 'CeAttachmentlist'
    },

    tbar: ['->',{
    	xtype:'fileupload',
    	multiple:true,
    	entity_to:'CeAttachment'
  }],

    columns: [
            {
                text     : '编号',
                dataIndex: 'id',
                filter: 'number'
            },
            {
                text     : '题名',
                dataIndex: 'name',
                width:400,
                filter: {
                    type: 'string',
                    itemDefaults: {
                        emptyText: 'Search for...'
                    }
                }
            },{
                text     : '文件大小',
                dataIndex: 'filesize',
                filter: 'number'
            },{
                text     : '类型',
                dataIndex: 'suffix',
                filter: {
                    type: 'list',
                    options: [
                      ['jpg', 'jpg'],
                      ['doc', 'doc'],
                      ['xls', 'xls'],
                      ['zip', 'zip']
                  ]
                }
            },{
                text     : '路径',
                dataIndex: 'path',
                width:320,
                renderer:function(v,r,rec, rowIndex, columnIndex, store){
                	var aid =rec.get('id');
                	var href;
                	//老网站附件
                	if(aid<DCApp.Cfg.ID_START){
                		href = DCApp.Cfg.WEB_ROOT_CC+'upload'+v.replace(/\\/g,'/');
                	}else{
                		href = "/fileopen?fp=" + v;
                	}
                	return "<a target='_blank' href='" + href + "'>"+v+"</a>";
                }
            }
        ]
 });
